約 2,526,006 件
https://w.atwiki.jp/usapfrog/pages/17.html
条件分岐 elifが特徴。" [ ", " ] "の前後には半角スペースを忘れずに。 i=0if [ $i -eq 1 ]; then echo $ielif [ $i -eq 2 ]; then echo $ielse echo $ifi if 文と test コマンド[1] ループ for i in 1 2 3; do echo $i done i=0while [ $i -ne 10 ]; do echo $i i=`expr $i + 1`done 無限ループ while [ 1 -eq 1 ]; dosleep 10done 置換 後方置換 (拡張子変換など, %で最短・%%で最長マッチ) for f in `ls *.dat`; do mv $f ${f%.dat}.txt done 前方置換 (共通ファイルヘッダ変換など,#最短・##最長) for f in `ls a*.dat`; do cp $f b${f#a} done 特定のフォルダにある同名ファイル収集用ルーチン ls dats 1 /dev/null 2 /dev/nullif [ $? -ne 0 ] ; then mkdir datsfifor d in `ls -d folder*/`; do f=${d%/} cat $f/data.txt dats/${f}.datdone folder, data, catコマンドあたりは適宜変更する doskey (=unixのalias) win用texliveとかのplatexは基本sjisなので。引数をとるときには$*を追加する。 [init.bat] @echo offdoskey utex=platex --kanji=utf8 $* 毎回使うときは例えば C \bin\init.batとかに保存して、レジストリ(regedit.exe)を開き HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor HKEY_CURRENT_USER\Software\Microsoft\Command Processor のどちらかに、 AutoRun で文字列値を追加、値を C \bin\init.bat とする。 参考 [1]UNIX Linux コマンド・シェルスクリプト リファレンス [2]bashプログラミング/whileループ [3]シェルスクリプトの変数展開(評価)でパターンマッチ おまえのログ [4]炎のコマンドプロンプト入門
https://w.atwiki.jp/stickranger-2/pages/65.html
チャージ武器一覧 Glove系 Bash Icon Lv AT EMIT SML ATR DROP 1 20-30 10 short Physical Cave 1imageプラグインエラー ご指定のファイルが見つかりません。ファイル名を確認して、再度指定してください。 (blue_mochi.png) 詳細 本編おススメ度 ★★★☆☆ コメント 追加情報などあればお書き下さい 名前 コメント すべてのコメントを見る
https://w.atwiki.jp/d2x2ch/pages/106.html
Bash 日本名:バッシュ 略称: 効果 必要レベル 1 必要スキル なし 攻撃属性 Physical 強力な一撃を加え、命中した相手をノックバックさせる。 Level 1 2 3 4 5 6 7 8 9 10 Mana Cost 2 Damage +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 Damage +% 50 55 60 65 70 75 80 85 90 95 Attack +% 20 25 30 35 40 45 50 55 60 65 Level 11 12 13 14 15 16 17 18 19 20 Mana Cost 2 Damage +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 Damage +% 100 105 110 115 120 125 130 135 140 145 Attack +% 70 75 80 85 90 95 100 105 110 115 Bonusを受けるスキル Stun +5% Damage Per Level (Synergy Bonus) Concentrate +5% Attack Rating Per Level (Synergy Bonus) Bonusを与えるスキル Concentrate +5% Damage Per Level (Synergy Bonus) Double Swing +10% Damage Per Level (Synergy Bonus) 評価 マナを消費して強力な一撃を加えるという至ってシンプルな近接打撃スキル。 ノックバックのわずらわしさが難点なのだが、通常攻撃よりはマシなので、通過スキルとして序盤使用する人も多いのではなかろうか。 スキルレベルに比例したダメージが追加されるので、振りの速い武器での運用が有効。 なお二刀流装備の場合、一番最後に振った武器のみでスキルを使う。 なので、両手剣の片手持ちでこれを使うメリットはほぼないことに注意。 使い方 敵をクリック! または、地面を右ドラッグして攻撃移動。 マナが足りない場合は、代わりに通常攻撃となる。 スキル振り シナジー目的以外は振らなくて良い。 その他 http //www.battle.net/diablo2exp/skills/barbarian-combatskills.shtml#bash 名前 コメント
https://w.atwiki.jp/uyeee/pages/23.html
bash ターミナルでのbeep音を消す ~/.inputrc に、以下の内容を追記する。 set bell-style none
https://w.atwiki.jp/yasukoba/pages/93.html
プログラム言語同様に特定回数繰り返し処理をさせることが可能. ステートメントの1種. モジュール直下には記述できないので,initial文やfunction,alwaysの中で用いる. 主にシミュレーション記述で用いられるものらしい. 記述例 integer i; always @(posedge clk) begin if(init) begin for(i=0; i WORD; i=i+1) begin ring_reg[i] = {PIX_WIDTH{1 b0}}; end end else if(shift_en) begin ring_reg[0] = ring_reg[WORD-1]; for(i=1; i WORD; i=i+1) begin ring_reg[i] = ring_reg[i-1]; end end else if(data_set) begin ring_reg[0] = data_in; for(i=1; i WORD; i=i+1) begin ring_reg[i] = ring_reg[i-1]; end end else begin for(i=0; i WORD; i=i+1) begin ring_reg[i] = ring_reg[i]; end end end
https://w.atwiki.jp/crsavrkouza/pages/27.html
10.繰り返し while文 for文 同じようなことを繰り返させるのに,同じようなことをひたすら書き続けるのは大変ですね. 例えば1から10までの数字を表示させることを考えます. 馬鹿正直に1行づつ書くと、下のプログラムのようになります. #include stdio.h int main(void) { printf("1\n\r"); printf("2\n\r"); printf("3\n\r"); printf("4\n\r"); printf("5\n\r"); printf("6\n\r"); printf("7\n\r"); printf("8\n\r"); printf("9\n\r"); printf("10\n\r"); return 0; } 今回は10までの数字でしたが、10000までの数字を1つずつ表示するとなったらどうすればよいでしょうか。 こうした単純な繰り返しこそコンピュータの得意技です.繰り返しの制御構文にwhile文,for文などがあります. while文について 繰り返し行う構文の一つです. 書式 while文で記述 (繰り返し開始時に行う処理) while(条件式) { 繰り返したい処理 ・ ・ ・ 1周するごとに実行する文 } while文は条件式が真のとき、{ }内の処理を繰り返します。 1から10000までの数字を表示させるプログラムをwhile文で記述します. #include stdio.h int main(void) { int x = 1; while(x 10001) { printf("%d\n\r", x); x++; } return 0; } 動きを1行ずつ追っていきます. まず,ループ用変数としてiが用意します. 次の行でwhile()に当たります.ループ条件は1 10001なので真です.{}内に進みます. printf()で1を表示します. i++でループ回数を1増やし,iは2になります. }にあたったらwhile()に戻ります. 2 10001なので{}内に進みます. 3,4,...9999回も同様です. 10000回目 printf()で10000を表示します. i++でiは10001になります. 100001 100001は偽です.{}を飛ばします. return 0にあたり,プログラムを終了します. これをいちいち1~10000までprintfを書くよりはるかに楽に記述できています. また,繰り返し回数が変数にできるところも大きな利点です. for文について while文同様繰り返しを記述できる構文です. while文への書き換えも可能ですが,どちらで記述した方が簡潔かは場合によりけりです.適切な使い分けをしましょう. 書式 for(繰り返し開始時に行う式(初期化式); 条件式; 1周するごとに実行する式(更新式)) { 繰り返したい処理 ・ ・ ・ } 1から10000まで出力するプログラムを書いてみます. #include stdio.h int main(void) { int i; for(i = 0; i 10000; i++) { printf("%d\n\r", i+1); } return 0; } 最初for文に入ったとき,for文の最初の文が実行され,iに0が代入されます. 次に真ん中の継続条件判定が行われ,これが真であるとき{}の中が実行され続けます. 最初iは0であり,0 10000は真なので実行されます. そして{}内に入りi+1,即ち1を出力します. }に当たったらfor文の最後i++が実行され,iが1増えて1になります. その次にfor文の継続条件判定を行います.1 10000は真なので実行されます. 2,3,4,...9999回目も同様です. 10000回出力後, i++の結果iが10000になると継続条件判定10000 10000が偽になるのでfor文から抜けます. その下のreturn 0でプログラムが終了します. 簡潔にまとめるとこんな感じです. int i; (繰り返しカウント用変数.) for(i = 0; i (繰り返したい回数); i++) { 繰り返したい処理 ・ ・ ・ } このようにして全く等価なfor文とwhile文を書き換えられます. for文で記述 for(初期化式; 条件式; 更新式) { 繰り返したい処理 ・ ・ ・ } while文で記述 (初期化式) while(条件式) { 繰り返したい処理 ・ ・ ・ 更新式 } 例題1 1つの正数nを入力し, 1+2+3+…nを計算し出力する(for文で) #include stdio.h int main(void) { int i, n, answer = 0; printf("正整数を入力してください "); scanf("%d", n); for(i = 0; i n; i++) { answer += i+1; } printf("1から%dまでの総和は%dです\n\r", n, answer); return 0; } 例題2 例題1をwhile文で #include stdio.h int main(void) { int i = 0, n, answer = 0; printf("正整数を入力してください "); scanf("%d", n); while(i n) { answer += i+1; i++; } printf("1から%dまでの総和は%dです\n\r", n, answer); return 0; } 演習1 九九の表を出力する. 演習2 1つの正数nを入力し,素数かどうか判定する.
https://w.atwiki.jp/naobe/pages/35.html
Unix/Linuxに戻る kshの機能をほぼ包含しているなあ testでの条件判定 条件 意 味 -z string 文字列の長さが0で真。 -n string string の長さが0より大きければ真。 -e file ファイルが存在すれば真。 -f file 通常のファイルで真。 -c file file が存在し、キャラクタスペシャルファイルであれば真。 -s file fileが存在し、サイズが0より大きければ真 -d file file が存在し、ディレクトリであれば真。 -h file or -L file file が存在し、シンボリックリンクであれば真。 string1 = string2 文字列string1が文字列string2と等しければ真。 string1 != string2 文字列string1が文字列string2と等しくなければ真。 arg1 op arg2 引数を数値とみなして大小を比較する。 オペレーション 項目 説明 -eq 等しい -ne 等しくない -lt 小さい -le 以下 -gt 大きい -ge 以上 算術式 パラメーターを正しく指定してください。の中で使われる。 算術式では、シェル変数を使うときに$は不要。 演算子 c言語と同じ。優先順は上から下。同じ行内では、左から右。 項目 説明 id++ id-- 変数を評価後、increment/decementする ++id --id - + ! ~ ** * / % + - = = 比較 == != ビット単位の AND ^ ビット単位の 排他的OR | ビット単位の OR || expr?expr expr = *= /= %= += -= = = = ^= |= expr1 , expr2 ()を使うと、優先順位が変わる。()が最優先。 条件式 [[]]の中で使われる。単語分割とパス名展開は [[ と ]] の間の単語に対しては行われません。チルダ展開、パラメータと変数の展開、算術式展開、コマンド置換、プロセス置換、クォート除去は実行されます。 下記の組み合わせを使える。優先順は上から下。 項目 説明 (expression) ! expression 否定 expression1 expression2 expression1 || expression2 expressionは、testコマンドの条件式を使える。testコマンドの条件式に加えて、 == などが使える。 【例】 if [[ ! $a == aaa || $b != bbb $c == ccc ]] 単語分割 IFSで区切って単語に分割する。空の引数("", )は削除されずに残る。 引数をワイルドカード展開しない 変数をダブルクォートで囲む 【例】 #!/bin/ksh FILEPATTERN=$1 find . -name "$FILEPATTERN" ジョブ制御 viを実行中に作業を中断し、シェルで作業をし、またviを再開するときに便利。 項目 説明 CTRL+Z フォアグラウンドジョブを一時停止する jobs -l jobの一覧を表示する fg [jobspec] jobspecで指定したジョブをフォアグラウンドで実行する。jobspecを省略した場合は最近実行したバックグラウンドジョブ/一時停止ジョブをフォアグラウンドで実行する。 jobspec 説明 %N ジョブ番号がNのジョブ %string stringで始まるジョブ %?string stringを含むコマンドのジョブ %+ または %% 最後に実行されたバックグラウンドジョブ %- 最後の1つ前に実行されたバックグラウンドジョブ local 変数1[=値1] [変数2[=値2] ...] bash拡張機能。関数の中で有効。スコープを関数と子供の関数に制限する。 【コードサンプル】 aaa() { local i j i=1 echo "before i=$i" bbb echo "after i=$i" } bbb() { i=2 } aaa echo "関数外 i=$i" 【実行結果】 before i=1 after i=2 関数外 i= $(コマンド) bash拡張機能。コマンド置換。`コマンド`と同じ。kshと同じ。 フローコントロール if コマンド; then elif コマンド; then else fi for 変数 in リスト do done for 変数 : コマンド引数を順々に処理する。 for 変数 in * : ファイルを順々に処理する。 for 変数 in $* : コマンド行引数を順々に処理する。 ※リストは複数の文字列をIFS(Internal Field Separator)環境変数の最初の文字で区切ったもの。IFSはデフォルトでは、スペース、タブ、改行。 for (( expr1; expr2; expr3 )) do ... done 【例】 for (( i = 0; i 10; i++ )) do echo $i done while コマンド do ... done until コマンド do ... done コマンド実行後の終了ステータスが0なら真。 【使用例】 #!/bin/sh i=0 while [ $i -ne 10 ] do echo $i i=`expr $i + 1` done 関数 使う前に定義する。 引数は、コマンドの引数と同様の方式で与える。 【使用例】 func() { echo $1 echo $2 echo $3 } func 1 2 3 return Nで、終了ステータス Nを返す。 expr シェルの中で算術演算を行う。 num=`expr $a + $b` 演算子: + - * / % 特別なシェル変数 項目 説明 $# 位置パラメータの数 $- シェルのオプション $? 最近実行したシェルの終了状態 $$ 現在のシェルのプロセス番号 $* シェルの引数のリスト。展開する時に"$1 $2 ..."と展開する。 $@ シェルの引数のリスト。展開する時に"$1" "$2" ...と展開する。 パラメータの展開 はない場合は、変数が未使用の場合に適用される。 がある場合は、null(VAR="" or VAR=)の場合と未使用の場合に適用される。 項 目 説 明 ${parameter -word} $parameterが未設定のときに一時的にparameter=wordとする。次のステップでは、$parameterは未設定のままとなる。 ${parameter =word} $parameterが未設定のときにparameter=wordとなる。以後、$parameterは、wordの値を保存する。 ${parameter +word} $parameterが設定されているときにparameter=wordとなる。設定されていないときは未設定のまま。 ${parameter#word} $parameterとwordを先頭からパターンマッチング(最短一致パターン)する。マッチしたら、$parameterからwordを除いたものに置換する。 ${parameter##word} $parameterとwordを先頭からパターンマッチング(最長一致パターン)する。マッチしたら、$parameterからwordを除いたものに置換する。【例】base=${1##*/} 引数1からディレクトリを除いたものを返す ${parameter%word} $parameterとwordを末尾からパターンマッチング(最短一致パターン)する。マッチしたら、$parameterからwordを除いたものに置換する。 ${parameter%%word} $parameterとwordを末尾からパターンマッチング(最長一致パターン)する。マッチしたら、$parameterからwordを除いたものに置換する。 ${parameter/patern/string} $parameterとpaternをパターンマッチング(最長一致パターン)する。マッチしたら、$parameterのpaternをstringに置き換えて置換する。置き換えるのは最初にマッチした部分のみ。 ${parameter//patern/string} $parameterとpaternをパターンマッチング(最長一致パターン)する。マッチしたら、$parameterのpaternをstringに置き換えて置換する。置き換えるのはマッチした全ての部分。【例】${p//[0-9]/} 変数pの数字をすべて削除する。 ${paraneter offset length} $parameterのoffset位置(0から始まる)からlength長を返す ${parameter =$word}の例 foo=456 word=foo parameter= echo "parameter1 ${parameter =$word} " echo "parameter2 $parameter" | V parameter1 foo parameter2 foo ${parameter -$word}の例 foo=456 word=foo parameter= echo "parameter1 ${parameter -$word} " echo "parameter2 $parameter" | V parameter1 foo parameter2 パターンマッチ置換の例 parameter=fooabbab echo "parameter1 ${parameter##fo*a} " echo "parameter2 $parameter" | V parameter1 b parameter2 local name1=value1 name2=value2 ... 関数の中で使われると、関数の中でだけ有効な変数nameを作成し、valueで示される値を変数に代入する。 タブをスペース/スペースをタブに変換する あるディレクトリ以下の対象ファイルのタブをスペースに変換する $ find . -name \*.java -exec expand.sh {} \; 【expand.sh】 FILE=$1 TAB_NUM=$2 if [ x$TAB_NUM = x ]; then TAB_NUM=8 fi expand -t $TAB_NUM $FILE ${FILE}_tab mv ${FILE}_tab $FILE スペースをタブに変換する場合は、unexpandコマンドを使う カレントディレクトリ下のファイルから文字列を検索する find.sh #!/bin/ksh FILEPATTERN=$1 PATTERN=$2 find . -name "$FILEPATTERN" -type f -exec grep.sh "$PATTERN" {} \; grep.sh #!/bin/ksh PATTERN=$1 FILE=$2 RESULT=`egrep $PATTERN $FILE` if [ $? = 0 ]; then echo $FILE echo "$RESULT" fi 【使用例】 find.sh \*.c ap_prelinked_modules
https://w.atwiki.jp/cmatome/pages/16.html
ニコニコ動画 http //www.nicovideo.jp/watch/sm8531180 for文 for文を使えば繰り返し処理ができる。次の配列を知るとfor文がもっと活躍できる。 ニコ動のプログラム using System; class Test6{ public static void Main(){ for(int i=0; i 10; i++){ //10回ループ Console.WriteLine("かっぱっぱ~"); } } } ちなみに、10回繰り返すだけなら for(int i=1; i =10; i++) とか for(int i=0; i =9; i++) でもできますが、前者のほうはiが1から始まるというのは次にやる配列との兼ね合いで推奨しません。 後者のi =9というのは(ここでは10回繰り返すのが)9回しか繰り返さないように見えてしまう可能性があり推奨しません。 forとifの組み合わせ) 動画のプログラム(少し改変しました。) using System; class Test6{ public static void Main(){ for(int i=0; i 10; i++){ //10回ループ if((i%2)==1){ //2で割ったあまりが1なら Console.WriteLine(i.ToString()+"は奇数です"); //ToStringをつけなくてもいいが、一応文字に変換するためのToString()つけます } else{ //2で割ってあまりが1でない、つまり0なら Console.WriteLine(i.ToString()+"は偶数です"); } } } } これはまぁ問題ないでしょう。 ここから高校数学の数列の内容が入ってきます。数列知らないひとや興味ない人は読み飛ばしてください 等差数列和はn(n+1)/2とかで簡単に求められますが、この場合forを使って練習するのでそれ禁止ね。 using System; class Test6{ public static void Main(){ int sum=0; for(int i=0; i 10; i++){ //10回ループ sum=sum+i; } Console.WriteLine("sum= "+sum.ToString(); } } 1+2+3+・・・+9を求めます 1+2+:::+9は漸化式をたてると S[n]=S[n-1]+n、S[0]=0。 一般に、A[n]=A[n-1]+nみたいに左にA[n]、右にA[n-1]とnだけ置いて A[n]とA[n-1]をSum,Sumの初期値をA[0],nをiとおいてそのまま書き換えればおk。 なぜそうすれば良いのかは面倒なので省略。数学とか好きな人は考えれ。 例: S[n]=2*S[n-1]+n/2,S[0]=0でS[5]を求めよ。 まず手動で求めてみましょう。S[1]=1/2、S[2]=2、S[3]=11/2、S[4]=13、S[5]=28.5 //S[n]とS[n-1]をS、n/2をi/2と置き換え double S=0; // n/2つまり小数が出てきてるのでint型ではなくdoubleを使う、S[0]=0なので初期値0 for(double d=1.0;d =5.0;d++){ //これも↓にi/2があるのでdouble、S[5]を求めるのでd =5.0。じゃないよ S=2*S+d/2; } Console.WriteLine(S.ToString()); 28.5って出てきました 実数型と整数型とキャスト ↑で、forループに使った変数をint型ではなくdouble型を使いました。 理由を説明します。 これを実行してみてください。 int i=3;double d; d=i/2; Console.WriteLine(d.ToString()); こたえいくつになるか?i=3でi/2なのでdは1.5になるはず。。。 ところが表示されたのは1でした。 i/2は両方整数型です。 したがって、i/2はそもそも整数です。[整数同士で割り算しても整数にしかなりません]。だからd=i/2とやってもdは1が入ってしまいました。 これを防ぐには d=(double)i/2; と。(double)をつけるか、i/2.0というように小数点をつけます。(小数をつけるのは整数型/実数型になり、あまり推奨しません。。。) これでi/2やi/2.0自体がdouble型だとみなされ、3/2は1.5になります。 こんな風に、(double)とかつけるのを型キャストとかいいます。 すべての型はできるだけ統一しておかないと、小数が整数になったり小数で計算してほしいのに整数扱いされて正しい数値が得られなくなってます。 悪い例 double d=3/2;Console.WriteLine(d.ToString()); 良い例 double d=3.0/2.0;またはd=(double)3/2; 次は1~15の掛け算 1*2*3*4*・・・*15 S[n]/S[n-1]=n⇒S[n]=S[n-1]*i、S[1]=1なのでS[n]とS[n-1]を適当な文字におきかえて double A=1;//めちゃくちゃでかい数なのでintでは収まらない、double型 for(double d=1;d =15;d++){ A=A*d; //Aは実数型なので、dも実数型にしました。 } Console.WriteLine(A.ToString()); 宿題の答えw 長々説明したけどべつにsum=sum+iとかはわからなくてもいいです。ここはアルゴリズムとか学ぶ場所じゃないんで。 while文 while(条件){ } 条件がtrueのときに処理を行い、ループする。満たしてないときに飛ばす。 動画の内容はやさしいので飛ばします。 break文 whileやfor文には、break;という文を加えることによって処理を強制的に抜け出せます。 例 while(true){ //処理 break; } たとえば、数値を入力してもらうときに 0という数値が入力されたら終了するときなどに使えます。 int Nyuuryoku; //Nyuuryokuになにか数を入れてもらう処理 while(true){ if(Nyuuryoku==0){ break; } //入力の処理 } do~while文なんてのもあります。 do{ }while(条件); 文の終了合図のセミコロンがついています!忘れないで do~whileは最低でも一回なにかやってほしいときに使います。 int x=1; while(x==2){ //処理 } ↑はwhileの間の処理は一度も実行されません。 int x=1 do{ //処理 }while(x==2); この処理は一度はかならず実行されます。
https://w.atwiki.jp/maisenakajima/pages/32.html
Reserved Bourne shell variables Variable name Definition CDPATH A colon-separated list of directories used as a search path for the cd built-in command. HOME The current user s home directory; the default for the cd built-in. The value of this variable is also used by tilde expansion. IFS A list of characters that separate fields; used when the shell splits words as part of expansion. MAIL If this parameter is set to a file name and the MAILPATH variable is not set, Bash informs the user of the arrival of mail in the specified file. MAILPATH A colon-separated list of file names which the shell periodically checks for new mail. OPTARG The value of the last option argument processed by the getopts built-in. OPTIND The index of the last option argument processed by the getopts built-in. PATH A colon-separated list of directories in which the shell looks for commands. PS1 The primary prompt string. The default value is " \s-\v\$ ". PS2 The secondary prompt string. The default value is " ". Reserved Bash variables Variable name Definition auto_resume This variable controls how the shell interacts with the user and job control. BASH The full pathname used to execute the current instance of Bash. BASH_ENV If this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup file to read before executing the script. BASH_VERSION The version number of the current instance of Bash. BASH_VERSINFO A read-only array variable whose members hold version information for this instance of Bash. COLUMNS Used by the select built-in to determine the terminal width when printing selection lists. Automatically set upon receipt of a SIGWINCH signal. COMP_CWORD An index into ${COMP_WORDS} of the word containing the current cursor position. COMP_LINE The current command line. COMP_POINT The index of the current cursor position relative to the beginning of the current command. COMP_WORDS An array variable consisting of the individual words in the current command line. COMPREPLY An array variable from which Bash reads the possible completions generated by a shell function invoked by the programmable completion facility. DIRSTACK An array variable containing the current contents of the directory stack. EUID The numeric effective user ID of the current user. FCEDIT The editor used as a default by the -e option to the fc built-in command. FIGNORE A colon-separated list of suffixes to ignore when performing file name completion. FUNCNAME The name of any currently-executing shell function. GLOBIGNORE A colon-separated list of patterns defining the set of file names to be ignored by file name expansion. GROUPS An array variable containing the list of groups of which the current user is a member. histchars Up to three characters which control history expansion, quick substitution, and tokenization. HISTCMD The history number, or index in the history list, of the current command. HISTCONTROL Defines whether a command is added to the history file. HISTFILE The name of the file to which the command history is saved. The default value is ~/.bash_history. HISTFILESIZE The maximum number of lines contained in the history file, defaults to 500. HISTIGNORE A colon-separated list of patterns used to decide which command lines should be saved in the history list. HISTSIZE The maximum number of commands to remember on the history list, default is 500. HOSTFILE Contains the name of a file in the same format as /etc/hosts that should be read when the shell needs to complete a hostname. HOSTNAME The name of the current host. HOSTTYPE A string describing the machine Bash is running on. IGNOREEOF Controls the action of the shell on receipt of an EOF character as the sole input. INPUTRC The name of the Readline initialization file, overriding the default /etc/inputrc. LANG Used to determine the locale category for any category not specifically selected with a variable starting with LC_. LC_ALL This variable overrides the value of LANG and any other LC_ variable specifying a locale category. LC_COLLATE This variable determines the collation order used when sorting the results of file name expansion, and determines the behavior of range expressions, equivalence classes, and collating sequences within file name expansion and pattern matching. LC_CTYPE This variable determines the interpretation of characters and the behavior of character classes within file name expansion and pattern matching. LC_MESSAGES This variable determines the locale used to translate double-quoted strings preceded by a "$" sign. LC_NUMERIC This variable determines the locale category used for number formatting. LINENO The line number in the script or shell function currently executing. LINES Used by the select built-in to determine the column length for printing selection lists. MACHTYPE A string that fully describes the system type on which Bash is executing, in the standard GNU CPU-COMPANY-SYSTEM format. MAILCHECK How often (in seconds) that the shell should check for mail in the files specified in the MAILPATH or MAIL variables. OLDPWD The previous working directory as set by the cd built-in. OPTERR If set to the value 1, Bash displays error messages generated by the getopts built-in. OSTYPE A string describing the operating system Bash is running on. PIPESTATUS An array variable containing a list of exit status values from the processes in the most recently executed foreground pipeline (which may contain only a single command). POSIXLY_CORRECT If this variable is in the environment when bash starts, the shell enters POSIX mode. PPID The process ID of the shell s parent process. PROMPT_COMMAND If set, the value is interpreted as a command to execute before the printing of each primary prompt (PS1). PS3 The value of this variable is used as the prompt for the select command. Defaults to " #? " PS4 The value is the prompt printed before the command line is echoed when the -x option is set; defaults to " + ". PWD The current working directory as set by the cd built-in command. RANDOM Each time this parameter is referenced, a random integer between 0 and 32767 is generated. Assigning a value to this variable seeds the random number generator. REPLY The default variable for the read built-in. SECONDS This variable expands to the number of seconds since the shell was started. SHELLOPTS A colon-separated list of enabled shell options. SHLVL Incremented by one each time a new instance of Bash is started. TIMEFORMAT The value of this parameter is used as a format string specifying how the timing information for pipelines prefixed with the time reserved word should be displayed. TMOUT If set to a value greater than zero, TMOUT is treated as the default timeout for the read built-in. In an interative shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt when the shell is interactive. Bash terminates after that number of seconds if input does not arrive. UID The numeric, real user ID of the current user. 参考資料 Bash Guide for Beginners Version 1.11 Last updated 20081227 Edition
https://w.atwiki.jp/dslua/pages/140.html
これはfor文を用いたサンプルです。 while文、repeat文との使い分けについては、不明です。 構文 for 変数 = 初期値, 終了値, 増加量 do ~ end 繰り返し ------------------------------------------ -- for(Luarida)のサンプル for_sample.lua ------------------------------------------ function main() canvas.drawCls(color(255,255,255)) canvas.drawText("for(Luarida)のサンプル", 0, 0, 24, color(0,0,0)) canvas.drawText("画面タッチで開始します。", 0, 30, 24, color(0,0,0)) touch(3) for x = 0 , 5 do for y = 0, 5 do canvas.drawText("x=" .. x .. " y=" .. y .. " ", x * 100, 30 * y + 60, 24, color(0,0,0)) end end canvas.drawText("画面タッチで終了します。", 0, 240, 24, color(0,0,0)) touch(3) end main() コメント(最大30行) 名前 コメント すべてのコメントを見る